/*
* @Author: puzhenglin
* @Date:   2018-03-21 14:28:37
* @Last Modified by:   puzhenglin
* @Last Modified time: 2018-03-25 20:16:16
*/
require('./index.css');
require('page/common/nav/index.js');
require('page/common/header/index.js');
require('util/slider/index.js');
var templateBanner = require('./banner.string');
var _mm = require('util/mall.js');
$(function() {
	//渲染banner 的html
	var bannerHtml = _mm.renderHtml(templateBanner);
	$('.banner-con').html(bannerHtml);
	//初始化banner
    var $slider =  $('.banner').unslider({
    	speed: 500,               //  The speed to animate each slide (in milliseconds)
		delay: 3000,              //  The delay between slide animations (in milliseconds)
		complete: function() {},  //  A function that gets called after every slide animation
		keys: true,               //  Enable keyboard (left, right) arrow shortcuts
		dots: true,               //  Display dot navigation
		fluid: false 
	});
    //前一张和后一张操作的事件绑定
    $('.banner-con .banner-arrow').click(function(){
    	var forward = $(this).hasClass('prev')?'prev' : 'next';
    	$slider.data('unslider')[forward]();
    });
});